#pragma once
#ifndef _CONTROLLER_H
#define _CONTROLLER_H

#include <list>
#include <queue>
#include "BattleStatus.h"
#include "Object.h"
#include "../common/Request.h"

using namespace std;

class Controller
{
private:
  Ptr< Object > currentSelected;
  Ptr< list< Ptr< Object > > > _pObjList;
  Ptr< BattleStatus > _pBattleStatus;
  Ptr< queue< Request > > _pReqQueue;
  Ptr< Terrain > _pTerrain;
  vector< Ptr< ObjectProperty > > _pPropertyList;

  // Internal handle functions
  vector< Ptr< Object > > get_objs (float x , float y);
  bool select_object (Ptr< Object > target);
  void delete_obj (Ptr< Object >& obj);

  // User request handler
  void create_obj_at (UINT objType, float x, float y);
  void delete_selected ();
  void select_at (float x, float y);
  void move_current_to (float x, float y);
  void attack_toward (float x, float y);
  void end_this_turn ();

  void init_property_list ();

public:
  Controller (Ptr< list< Ptr< Object > > > pObjList,
              Ptr< BattleStatus > pBattleStatus,
              Ptr< queue< Request > > pReqQueue,
              Ptr< Terrain > pTerrain);
  void run ();
};




#endif